/*
	ANCData - Plugin blogger
	Author by Suzuki_aka
	Version 1.0;
*/

var anc = {
	max:0,home:"phimtuyenchon.net",post:100,
	title: new Array(),
	url: new Array(),
	label: new Array(),
	img:{f:new Array(), i72:new Array(),no:"http://2.bp.blogspot.com/-7XkENH-SCdg/UNh_In2PvqI/AAAAAAAABGA/Fp69KOfPjyU/s1600/logoptc1.png"},
	content: new Array(),
	snippet: new Array(),
	date:{d: new Array(),m: new Array(),y: new Array()},
	author: new Array()
}

function d_write(h,e,f){dsrc="http://www."+anc.home+"/feeds/posts/default/-/"+h+"?max-results="+e+"&amp;orderby=published&amp;alt=json-in-script&amp;callback=ancdata";document.write('<script src="'+dsrc+'"><\/script>');document.write("<script>"+f+"();<\/script>")}function stripHtmlTags(h,e){h=h.replace(/<br.*?>/ig," ");return h.replace(/<.*?>/ig,"").split(/\s+/).slice(0,e-1).join(" ")}numposts=anc.post;
function ancdata(h){maxpost=numposts<=h.feed.entry.length?numposts:h.feed.entry.length;anc.max=maxpost;for(var e=0;e<maxpost;e++){var f=h.feed.entry[e];title=f.title.$t;anc.title[e]=title;for(var g=0;g<f.link.length;g++)if("alternate"==f.link[g].rel){anc.url[e]=f.link[g].href;break}var i="";if(f.category)for(g=0;g<f.category.length;g++)i+='<a class="label-link" href="http://www.'+anc.home+"/search/label/"+f.category[g].term+'">'+f.category[g].term+"</a>,";else i="No label";anc.label[e]=i;anc.author[e]=
f.author[0].name.$t;g=f.published.$t;anc.date.d[e]=g.split("-")[2].substring(0,2);anc.date.m[e]=g.split("-")[1];anc.date.y[e]=g.split("-")[0];anc.content[e]="content"in f?f.content.$t:"summary"in f?f.summary.$t:"";s=anc.content[e];anc.snippet[e]=stripHtmlTags(s,250);a=s.indexOf("<img");b=s.indexOf('src="',a);c=s.indexOf('"',b+5);d=s.substr(b+5,c-b-5);anc.img.f[e]=-1!=a&&-1!=b&&-1!=c&&""!=d?d:anc.img.no;"media$thumbnail"in f?thumburl=f.media$thumbnail.url:thumburl=anc.img.no;anc.img.i72[e]=thumburl;
if(e==h.feed.entry.length)break}};